package com.sky.mapper;

import com.sky.annotation.AutoFill;
import com.sky.dto.SetmealDTO;
import com.sky.entity.DishFlavor;
import com.sky.entity.SetmealDish;
import com.sky.enumeration.OperationType;
import com.sky.vo.SetmealVO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;


import java.util.List;

@Mapper
public interface SetMealDishMapper
{
    /**
     * 根据菜品id查对应的套餐id
     * @param dishIds
     * @return
     */
    //select setmeal_id from setmeal_dish where dish_id=(1,2,3)
    List<Long> getSetMealIdByDishIds(List<Long> dishIds);


    /**
     * 新增 套餐-菜品 关系
     * @param setmealDish
     */
    void insert(SetmealDish setmealDish);

    /**
     * 批量删除 套餐和菜品的关系
     * @param setmealIds
     */
    void deleteBatch(List<Long> setmealIds);

    /**
     * 根据套餐id删除对应的 套餐-菜品关系
     * @param setMealId
     */
    @Delete("delete from setmeal_dish where setmeal_id= #{setMealId}")
    void deleteById(Long setMealId);

    /**
     * 批量新增 套餐-菜品关系
     * @param dishes
     */
    void insertBatch(List<SetmealDish> dishes);

    /**
     * 根据套餐id查询对应的 套餐-菜品关系
     * @param setmealId
     * @return
     */
    @Select("select * from setmeal_dish where setmeal_id= #{setmealId}")
    List<SetmealDish> getByIdwithDish(long setmealId);
}
